home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.19950726-19950929
/
000264_news@columbia.edu_Thu Aug 31 15:16:54 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-12-25
|
12KB
Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA17420
(5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Thu, 31 Aug 1995 12:32:39 -0400
Received: by apakabar.cc.columbia.edu id AA11175
(5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Thu, 31 Aug 1995 12:32:36 -0400
Path: news.columbia.edu!panix!news.mathworks.com!tank.news.pipex.net!pipex!lade.news.pipex.net!pipex!sunic!sunic.sunet.se!news.isnet.is!news.ismennt.is!news
From: halldorg@ismennt.is (Halldor Gudmundssson)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: kermit script for unix
Date: Thu, 31 Aug 1995 15:16:54 GMT
Organization: Islenska Menntanetid (The icelandic edu. Network)
Lines: 335
Distribution: world
Message-Id: <424kfg$1jo@folda.ismennt.is>
References: <DE3yCz.Fzz@utnetw.utoledo.edu>
Reply-To: halldorg@ismennt.is
Nntp-Posting-Host: rvik.ismennt.is
X-Newsreader: Forte Free Agent 1.0.82
Apparently-To: kermit.misc@watsun.cc.columbia.edu
crszczub@cse.utoledo.edu (craig szczublewski) wrote:
>I just downloaded the new version of ms kermit and have been trying to
>set up a script as to automatically log into a unix machine (ie, standard
>login:, password:) and I cannot get it to work. It's like it does not
>even see the incoming charcters. I have set up scripts like this before
>for 5A(190) under AIX and SCO, but this is my first attempt at an ms-dos
>machine. Any helpfull insights for migrating scripts from unix to dos?
>thanks in advance
>--
> +---------------------------+ +------------------------------------+
> | Craig Szczublewski |+ | crszczub@jupiter.cse.utoledo.edu |+
> | Unique Systems, Inc. || | 4gen!unique!craig%uunet.uu.net ||
> | 5610 Monroe St. Suite 210 || |------------------------------------||
> | Sylvania, OH 43560 || | A system without COBOL or FORTRAN ||
> | (419) 882-1113 || | is like a piece of chocolate cake ||
> | FAX (419) 882-2911 || | without ketchup and mustard ||
> +---------------------------+| +------------------------------------+|
> +---------------------------+ +------------------------------------+
this is a script and you should run kermit from batchfile like
@echo off
kermit def passwd <yourpassw> ,def userid <youruid>, take k1.scr, stay
define getout out \13,-
inp 3 >,-
if succ out exit\13,-
inp 10 >,-
if succ hangup,out +++ATH\13, pause 5, out ath\13,pause 2,-
exit
set key \2320 {\Kgetout} ; Assign GETOUT macro to
Alt-Q.
set com3 \x3E8 11
Set PORT 3
SET BAUD 19200
SET FLOW rts
SET DISP 8
SET TERM BELL NONE
SET RECEIVE PACKET 2000
SET TRANSLATE INPUT ON
SET WINDOWS 4
set transfer char latin1
set input timeout proceed ; Allow IF SUCCESS, IF FAILURE
set input echo on ; Don't echo the modem test
; Define ERRSTOP macro to issue an error message and stop.
;
define errstop echo \%1, hangup, stop
; FILE MT1432.SCR (MSMT1432.SCR)
;
; An MS-DOS Kermit script program for dialing the Multitech MT1432
series
; modems, to be used with MS-DOS Kermit 3.12 or later. The modem is
set
; for compression, error correction, all types of fallback, RTS/CTS
; flow control, and a fixed interface speed of 57600 or 38400.
;
; Authors: Christine M. Gianone, Frank da Cruz, Max Evarts;
; Columbia University, June 1993
; Modified May 1994 to remove DSR check (Peter Mossel)
;
def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 You must SET LINE
first
define chkerr if fail stop 1 \%1
define chkok input 3 OK, if fail stop 1 \%1
set input echo on ; So we can watch what happens.
set input timeout proceed ; Allow IF SUCCESS, IF FAILURE.
set input case ignore ; Use caseless string comparisons
set parity none ; Avoid parity foulups
set flow none ; Avoid flow control deadlocks
hangup ; Begin by dropping DTR
pause 1 ; for one second
; Speed. Don't worry about modem, it autobauds up to 57600.
set speed 19200 ; If computer can be set to 57600 bps,
use it.
if fail set speed 9600 ; If not, use 19200.
echo Configuring MultiTech MT1432 on \v(line).
:INIT
output ATQ0V1\13 ; Enable word result codes
chkok {Can't get modem's attention}
output AT E1 &Q1 X4\13 ; Echoing, result codes, etc.
chkok {Can't initialize modem}
echo Enabling modulation negotiation...
output AT $SB\v(speed) $MB19200\13 ; Start modulation speed
negotiation
; at V32bis, set interface speed
chkok {Can't enable modulation speed negotiation}
echo Enabling hardware flow control...
output AT &E4\13 ; RTS/CTS hardware flow control
chkok {Can't enable RTS/CTS} ; On modem
wait 5 cts
if fail errfail {Modem is not asserting CTS!}
set flow rts/cts ; And in Kermit too, but only now
echo Configuring modem to ignore BREAK...
output AT %E1\13 ; Make modem ignore BREAK
chkok {Can't become transparent to BREAK}
echo Enabling error correction and data compression...
output AT &E1 &E15 $BA0\13 ; Enable error correction &
compression
; with automatic speed buffering
chkok {Can't enable compression EC and fallback}
:BEGIN ; Now DIAL.
clear ; Clear INPUT buffer.
set count 5 ; Dialing retry counter, 5 tries
allowed.
echo Dialing 5811100 on \v(line) at \v(speed) bps, wait...
echo
pause 1
goto dial ; 1st time, skip pause and Redialing
message
:REDIAL
set alarm 30
pause 30 ; Wait 30 seconds before redialing.
if not alarm errfail {Dialing canceled.}
echo Redialing... ; Message for redialing.
pause 1
:DIAL
output ATDT5811100\13 ; Dial the number.
set alarm 90 ; (For detecting keyboard
interruptions.)
if > VERSION 312 clear input ; Clear echo from INPUT buffer.
if < VERSION 313 clear
input 30 \10 ; Wait for the linefeeds...
:GETMSG
input 60 \10 ; ...that surround the response
message.
if success goto gotmsg ; Got a message.
if alarm errfail {No response from modem.} ; No response in 90
seconds.
hangup ; User interrupted from keyboard,
output \13 ; cancel dialing by sending carriage
return,
goto again ; and go try again right away.
:GOTMSG
reinput 1 CONNECT ; Got a message, was it CONNECT?
if success goto done ; If so, we're done.
reinput 1 BUSY ; Line is busy.
if success goto busy ; Go wait a while and then dial again.
reinput 1 ERROR ; Command syntax error.
if success errfail {Dialing command error}
reinput 1 NO CARRIER ; Phone didn't answer or no carrier.
if success errfail {No answer or no carrier}
reinput 1 NO DIALTONE ; No dialtone when phone taken off
hook.
if success errfail {No dialtone - Is your modem connected to the phone
line\63}
goto getmsg ; None of the above, get another
message.
:BUSY
if < \v(count) 2 goto quit ; Don't wait 30 seconds if tries are
used up.
echo Line is busy, will dial again in 30 seconds.
echo Press any key to cancel...
output \13 ; CR cancels dialing
hangup ; Hang up.
:AGAIN
if count goto redial ; Then go redial.
:QUIT
errfail {It never answers! I give up.} ; Too many tries.
:DONE ; Connected.
echo \7 ; Celebrate with a beep.
input 20 ):
output 1\13
goto login
define errfail ; Erase local macro definitions...
end 0 ; Finished, return success code.
:FAIL ; Dialing failed, no beep.
define errfail ; Erase local macro definitions...
end 1 ; Return failure code.
; End of MT1432.SCR
; Action starts here
; If they typed their password on the DOS command line,
; clear the screen now.
;
if def passwd cls ; for security...
def \%9 ; "Thank you" flag.
if def userid goto askpw
:XUID
;
; User ID wasn't specified on command line, so prompt for it.
;
ask \%8 {Enter your userid Enter: }
if not def \%8 goto XUID
assign userid \%8
def \%9 Thank you.
:ASKPW
if def passwd goto thanks
:XPWD
;
; Password wasn't specified on command line, so prompt for it.
;
askq \%8 -
{Enter Password (it will not echo) and press ENTER: }
if not def \%8 goto XPWD
assign passwd \%8
def \%9 Thank you.
:THANKS
def \%8 ; Erase password from memory
if def \%9 echo \%9 ; Be polite
def \%9
echo
set input case ignore ; Don't care about alphabetic case.
hangup ; Hang up any current data connection.
set input timeout proceed ; Allow IF SUCCESS, IF FAILURE
set input echo on ; Don't echo the modem test
output ATQ0V1X1\13 ; Send AT, use word result codes.
input 5 OK ; Modem should say "OK"
Output \13
Set count 4
:LOOP
output \13AT\13 ; Give the Hayes modem AT command
input 5 OK ; Look for Hayes OK response.
if failure goto RETRY ; Not found, try again.
echo Hringi ! menntaneti ... ; It's 244PC, tell the user.
output ATDT5683370\13 ; Make a data call to "[CUNIX]".
input 30 CONNECT ; Look for modem's confirmation.
if success goto GOOD
:RETRY
if count goto LOOP
set count 4
:L2
output ATDT5811100\13
input 30 CONNECT
if success goto GOOD2
if count goto L2
; Get here when there is no communication after 3 tries.
;
echo
echo { Modem not answering.}
echo { You are using port \v(port), and speed is \v(speed).}
echo { if this is not correct use SET PORT in Kermit}
echo { and SET SPEED and try again.}
echo { Check if modem is connected and }
echo { that it is powered on}
echo
hangup
stop
:GOOD
; We got through, one way or the other.
; Send carriage returns for speed recognition.
; Try up to 5 times to get Info terminal server prompt, "blah>".
;
set count 5 ; Loop counter.
:AGAIN
output \13 ; Send CR for speed recognition.
input 20 > ; Look for prompt.
if success goto INFO ; If found, proceed with login
process,
if count goto again ; otherwise continue the loop.
errstp {Failed to connect to main computer - try again}
:INFO
goto UNA
set count 5
:GOOD2
input 20 ):
if success goto RVIK
out +++ATH\13
pause 5
out ath\13
pause 2
if count goto RETRY
errstp {No answere from machinhe.}
:RVIK
output 1\13
input 20 login:
if fail errstop {Did not get login }
GOTO LOGIN
;
; Got terminal server prompt, select cunix and wait for login prompt.
;
:UNA
output una\13
input 20 login:
if fail errstop {did not get login prompt - try again}
:LOGIN
;
; Got "login:" prompt, send user ID and look for "Password:" prompt.
;
output \m(userid)\13 ; Send user ID, followed by CR.
input 20 Password: ; Wait up to 5 seconds for "Password:"
prompt.
if fail errstop {did not get password prompt}
; Send user's password, then wait for shell prompt.
; Here we must figure out whether it is "$ " or "% ".
; If it is anything else, such as "cunixa:", that must be
; predefined (see top of this file).
;
output \m(passwd)\13 ; Send password.
define passwd ; Erase from memory.
; Now try to get the shell prompt.
;
CONNECT
Halldor Gudmundsson
halldorg@ismennt.is
http://rvik.ismennt.is/~halldorg